package barinadroid.game;

import org.andengine.util.adt.pool.GenericPool;

public class EnemyPool extends GenericPool<Enemy>
{
	public static EnemyPool instance;

	public static EnemyPool sharedBulletPool()
	{
		if(instance == null)
			instance = new EnemyPool();
		return instance;
	}

	private EnemyPool()
	{
		super();
	}

	@Override
	protected Enemy onAllocatePoolItem()
	{
		return new Enemy();
	}

	@Override
	protected void onHandleRecycleItem(final Enemy e)
	{
		e.clearEntityModifiers();
		e.clearUpdateHandlers();
		e.detachSelf();
		e.getSprite().clearEntityModifiers();
		e.getSprite().clearUpdateHandlers();
		e.getSprite().setVisible(false);
		e.reset();
	}
}